// https : // iai.sh.cn/problem/558
#include <bits/stdc++.h>
using namespace std;
long long a[300001];
long long Mod = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i <= n; i++) {
    cin >> a[n - i];
  }
  long long x = 1;
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    // cout << x << endl;
    ans = (ans + (a[i] * x) % Mod) % Mod;
    x = (x * (m - i)) % Mod;
  }
  // cout << ans << endl; 
  cout << (ans + Mod) % Mod;
  return 0;
}